package com.iris.live.services.data.repositories;

import com.iris.live.services.data.models.Lsh随车项目设置Model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Date;
import java.util.List;

/**
 * Created by EngLee on 2016/8/12.
 */
@Transactional
public interface Lsh随车项目设置repository extends JpaRepository<Lsh随车项目设置Model, Integer>, JpaSpecificationExecutor<Lsh随车项目设置Model>{

    @Query("select a from Lsh随车项目设置Model a where a.车型编号=?1 and a.许可=?2 order by a.启用时间")
    List<Lsh随车项目设置Model> lsh随车findBy车型编号And许可(Integer carCode, String permit);

    @Modifying
    @Query("update Lsh随车项目设置Model a set a.启用时间=?2 where a.项目成本编号=?1")
    void updateById(Integer id,Date sqlDate);
}
